package com.baiyang.server.service.transaction.impl;


import com.baiyang.server.dao.transaction.LogisticsDao;
import com.baiyang.server.service.book.impl.ShoppingCartService;
import com.baiyang.server.service.impl.BaseServiceImpl;
import com.baiyang.server.service.transaction.LogisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baiyang.server.dao.transaction.OrdersDao;
import com.baiyang.server.model.transaction.Orders;
import com.baiyang.server.service.transaction.OrdersService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 
 * @author XVX
 * BY: @Primary 注解帮助生命@Autowired优先注入的实列
 */
@Service	
public class OrdersServiceImpl extends BaseServiceImpl<OrdersDao, Orders> implements OrdersService{
    @Autowired
    private OrdersDao ordersDao = null;
    @Autowired
    private LogisticsService logisticsService = null;


    /**
     * 下单
     * @param orders
     */
    @Transactional
    @Override
    public void placeOrder(Orders orders) {
        ordersDao.insert(orders);
    }

    @Override
    public int getMonthlySales(String id) {
        Integer integer =  ordersDao.getMonthlySales(id);
        return integer==null?0:integer;
    }
}
